package servlet;

import java.io.IOException;
import java.util.Properties;

import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import sessionBean.LoginCtrlRemote;

/**
 * Servlet implementation class LoginServlet
 */
public class LoginServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public LoginServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}
	
	private LoginCtrlRemote getLoginCtrl() throws NamingException {
		
		Properties p = new Properties();
		p.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
		p.setProperty("java.naming.provider.url", "localhost:1099");
		p.setProperty("java.naming.url.pkgs", "org.jboss.naming");
		
		Object obj = new InitialContext(p).lookup("LoginCtrl/remote");
		
		return (LoginCtrlRemote)PortableRemoteObject.narrow(obj, LoginCtrlRemote.class);
		
	}

}
